using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._JoinsandRelates
{
    /// <summary>
    /// <para>Add Join</para>
    /// <para>Joins a layer to another layer or table based on a common field. Feature layers, table views, and raster layers with a raster attribute table are supported.</para>
    /// <para>基于公共字段将一个图层连接到另一个图层或表。支持要素图层、表视图和具有栅格属性表的栅格图层。</para>
    /// </summary>    
    [DisplayName("Add Join")]
    public class AddJoin : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AddJoin()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_layer_or_view">
        /// <para>Input Table</para>
        /// <para>The layer or table view to which the join table will be joined.</para>
        /// <para>连接表将连接到的图层或表视图。</para>
        /// </param>
        /// <param name="_in_field">
        /// <para>Input Join Field</para>
        /// <para>The field in the input layer or table view on which the join will be based.</para>
        /// <para>连接将基于的输入图层或表视图中的字段。</para>
        /// </param>
        /// <param name="_join_table">
        /// <para>Join Table</para>
        /// <para>The table or table view to be joined to the input layer or table view.</para>
        /// <para>要连接到输入图层或表视图的表或表视图。</para>
        /// </param>
        /// <param name="_join_field">
        /// <para>Join Table Field</para>
        /// <para>The field in the join table that contains the values on which the join will be based.</para>
        /// <para>连接表中包含连接所基于的值的字段。</para>
        /// </param>
        public AddJoin(object _in_layer_or_view, object _in_field, object _join_table, object _join_field)
        {
            this._in_layer_or_view = _in_layer_or_view;
            this._in_field = _in_field;
            this._join_table = _join_table;
            this._join_field = _join_field;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Add Join";

        public override string CallName => "management.AddJoin";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_layer_or_view, _in_field, _join_table, _join_field, _join_type.GetGPValue(), _out_layer_or_view];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The layer or table view to which the join table will be joined.</para>
        /// <para>连接表将连接到的图层或表视图。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_layer_or_view { get; set; }


        /// <summary>
        /// <para>Input Join Field</para>
        /// <para>The field in the input layer or table view on which the join will be based.</para>
        /// <para>连接将基于的输入图层或表视图中的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Join Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_field { get; set; }


        /// <summary>
        /// <para>Join Table</para>
        /// <para>The table or table view to be joined to the input layer or table view.</para>
        /// <para>要连接到输入图层或表视图的表或表视图。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Join Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _join_table { get; set; }


        /// <summary>
        /// <para>Join Table Field</para>
        /// <para>The field in the join table that contains the values on which the join will be based.</para>
        /// <para>连接表中包含连接所基于的值的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Join Table Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _join_field { get; set; }


        /// <summary>
        /// <para>Keep All Target Features</para>
        /// <para><xdoc>
        ///   <para>Specifies whether only records in the input that match a record in the join table will be included in the output.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—All records in the input layer or table view will be included in the output. This is also known as an outer join. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—Only those records in the input that match a row in the join table will be included in the output. This is also known as an inner join.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定输出中是否仅包含输入中与联接表中的记录匹配的记录。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 输入图层或表视图中的所有记录都将包含在输出中。这也称为外联接。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 只有输入中与连接表中的行匹配的记录才会包含在输出中。这也称为内部联接。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Keep All Target Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _join_type_value _join_type { get; set; } = _join_type_value._true;

        public enum _join_type_value
        {
            /// <summary>
            /// <para>KEEP_ALL</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("KEEP_ALL")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>KEEP_COMMON</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("KEEP_COMMON")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Updated Input Layer or Table View</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Layer or Table View")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_layer_or_view { get; set; }


        public AddJoin SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}